<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form id="register">
        <label for="username">用户名</label>
        <input id="username" name="username"/>
        <input type="submit"/>
        <input type="reset"/>
    </form>
    <script>
        let usernameInput = document.getElementById('username');
        let registerForm = document.getElementById('register');
        usernameInput.addEventListener('input',(event)=>{
            console.log('input');
        });
        usernameInput.addEventListener('change',(event)=>{
            console.log('change');
        });
        usernameInput.addEventListener('focus',(event)=>{
            console.log('focus');
        });
        usernameInput.addEventListener('blur',(event)=>{
            console.log('blur');
        });
        usernameInput.addEventListener('select',(event)=>{
            console.log('select');
        });
        registerForm.addEventListener('submit',(event)=>{
            event.preventDefault();
            console.log('submit');
        });
        registerForm.addEventListener('reset',()=>{
            console.log('reset');
        });
    </script>
</body>
</html>